package com.platform.util;

import java.util.Arrays;

/**
 * @program:
 * @Description:
 * @Author: liweihai
 * @Date: Created in 2019/1/12 16:22
 */
public enum OrderTypeEnum {
    ORDER_NO(0, "出错了"),
    ORDER_TYPE_WX(1, "微信"),
    ORDER_TYPE_ALI(2, "支付宝"),
    ORDER_TYPE_BANK(3, "银行卡"),
    ORDER_TYPE_SPC(4, "SPC兑换"),
    ORDER_TYPE_AMOUNT(5, "余额兑换");


    private int key;
    private String value;

    public int getKey() {
        return key;
    }

    public void setKey(int key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    OrderTypeEnum(int key, String value) {
        this.key = key;
        this.value = value;
    }

    public static String getDesc(int key) {

        OrderTypeEnum result = Arrays.stream(OrderTypeEnum.values()).filter(state -> state.getKey() == key).findFirst().orElse(OrderTypeEnum.ORDER_NO);
        return result.getValue();

    }
}
